package architect.design.patterns.structural.proxy;

/**
 * 文件夹代理
 *
 * @author guanxin
 * @date 2018/5/5 16:34
 */

public class FolderProxy implements IFolder {

    Folder folder;
    User user;

    public FolderProxy(User user) {
        this.user = user;
    }

    public void performOperations() {
        if (user.getUserName().equalsIgnoreCase("lily") &&
                user.getPassword().equalsIgnoreCase("xyz")) {
            folder = new Folder();
            folder.performOperations();
        } else {
            System.out.println("You don't have access to this folder");
        }
    }
}
